 <link href="<?= STATICURL; ?>css/bootstrap.min.css" rel="stylesheet" />
    <link id="bootstrap-rtl-link" href="" rel="stylesheet" />
    <link href="<?= STATICURL; ?>css/font-awesome.min.css" rel="stylesheet" />
    <link href="<?= STATICURL; ?>css/weather-icons.min.css" rel="stylesheet" />
    <!--Fonts-->
    <link href="http://fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,600,700,300" rel="stylesheet" type="text/css">
    <!--Beyond styles-->
    <link id="beyond-link" href="<?= STATICURL; ?>css/beyond.min.css" rel="stylesheet" type="text/css" />
    <link href="<?= STATICURL; ?>css/demo.min.css" rel="stylesheet" />
    <link href="<?= STATICURL; ?>css/typicons.min.css" rel="stylesheet" />
    <link href="<?= STATICURL; ?>css/animate.min.css" rel="stylesheet" />
    <link id="skin-link" href="" rel="stylesheet" type="text/css" />
    <div class="page-content">
        <div class="page-body">
            <div id="horizontal-form">
                    <form class="form-horizontal" role="form">
                       
                        <div class="row">
                            <div class="col-md-7">
                                <input class="form-control js_name" type="text"  p_level="<?=$cat_row['p_level']?>" value="<?=$cat_row['cat_name']?>" placeholder="请输入分类名称">
                                <div class="horizontal-space"></div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-7">
                                <input maxlength=3 placeholder="排序 默认0" class="form-control js_order" type="text" value="<?=$cat_row['sort_order']?>" />
                                <div class="horizontal-space"></div>
                            </div>
                        </div>
                        <div class="row js_category_cover" style="display: <?php if($cat_row['p_level']==2){echo 'block';}else{echo 'none';}?>;float: left;">
                            <div class="col-md-7">
                                <div class="recent-posts" style="float: left">
                                    <li class="cp_photo_con" style="list-style-type:none;">
                                        <p ><span  id="J_morepic_upload"></span></p>
                                    </li>
                                </div>
                                <div class="widget-content" style="float: right">
                                    <ul class="thumbnails picList">
                                    <?php if($cat_row['cover']):?>
                                            <li style="list-style-type:none;">
                                                <a> <img class="imgurl" src="<?= $cat_row['cover'] ?>" width="170" height="100" alt="" > </a>
                                            </li>
                                    <?php endif?>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="horizontal-space"></div>
                        <div style="clear: both">
                            <span id="js_submit" class="btn btn-default">修 改</span>
                        </div>
                    </form>
                </div>
        </div>
<script src="<?php echo STATICURL; ?>js/jquery-2.0.3.min.js"></script>
<script src="<?php echo STATICURL; ?>js/bootstrap.min.js"></script>
<script src="<?php echo STATICURL; ?>layer/layer.js"></script>
<script src="<?php echo STATICURL; ?>js/swfupload.js"></script>
<script src="<?php echo STATICURL; ?>js/swfupload.queue.js"></script>
<script src="<?php echo STATICURL; ?>js/fileprogress.js"></script>
<script src="<?php echo STATICURL; ?>js/handlers.js"></script>
<?php require_once ADMINVIEWPATH.'admin_footer.php'; ?>

<script>
  $(document).ready(function(){
    	var default_order = "<?=$cat_row['sort_order']?>";
		$(".js_order").bind({
				keyup:function(){
					 var txt = $('.js_order').val();
					 var reg = /^[\d]+$/;
					 if(!reg.test(txt) ){
					 		$(this).val('');
					 }
				},
				focus:function(){
		 			if ($(this).val() == 0){
		 				$(this).val('');
		 			}
				},
				blur:function(){
		 			if ($(this).val() == ''){
		 				$(this).val(default_order);
		 			}		 			
				}
		});  

 		$("#js_submit").click(function(){
 			if ($(".js_name").val() == ""){
 				layer.msg("请输入分类名称");
 				$(".js_name").focus();
 				return;
 			}
            var next_level = $(".js_name").attr('p_level');
            if(next_level == 4){
                layer.msg("此分类不可建子分类，请选择其他分类");
                return false;
            }
            var cover = $(".imgurl").attr("src"); 
            if(cover == undefined){
                var cover = ""; 
            }
            
			$.post("/luckydog/category/do_edit", {next_level:next_level,cover:cover,cat_name:$(".js_name").val(),cat_id:"<?=$cat_row['cat_id']?>",sort_order:$(".js_order").val()}, function(data) {				
				if (data.status) {
					layer.msg(data.message);
					window.parent.location.reload();
				}else{
					layer.msg(data.message);
				}
			}, "json");
 		});
	});
  $(function(){
        var settings = {
            flash_url : "<?php echo STATICURL; ?>js/swfupload.swf",
            upload_url: "<?=BASEURL?>luckydog/ad/upload_cover.json",
            post_params: {"is_more" : "yes"},
            file_size_limit : "1 MB",
            file_types : "*.jpg;*.gif;*.jpeg;*.png;",
            file_upload_limit : 100,
            file_queue_limit : 100,
            custom_settings : {
                progressTarget : "fsUploadProgress",
                cancelButtonId : "btnCancel"
            },
            debug : false,
            // Button settings
            button_width : "114",
            button_height : "32",
            button_placeholder_id : "J_morepic_upload",
            button_text_style : ".theFont { font-size: 16;}",
            button_cursor:-2,
            button_window_mode:"TRANSPARENT",
            button_action:-100,//-110多图片上传，-100但图片上传，-120文件上传
            button_image_url : "<?php echo STATICURL; ?>img/banner_upload_place.png",

            file_queued_handler : fileQueued,
            file_queue_error_handler : fileQueueError,
            file_dialog_complete_handler : fileDialogComplete,
            upload_start_handler : banner_uploadStart,
            upload_progress_handler : uploadProgress,
            upload_error_handler : uploadError,
            upload_success_handler : banner_upload_Success,
            upload_complete_handler : uploadComplete
        };
        swfu = new SWFUpload(settings);
    }())
</script>
</script>


